<?php

namespace Kunfeng\Dify\Event;

/**
 * 循环下一步事件
 */
class LoopNextEvent extends BaseEvent
{
    private $loopId;
    private $data;

    public function __construct(
        string $event,
        array $data = []
    ) {
        parent::__construct($event, $data);
        
        $this->loopId = $data['loop_id'] ?? '';
        $this->data = $data['data'] ?? [];
    }
    /**
     * 从数组创建事件
     */
    public static function fromArray(array $data)
    {
        return new self($data['event'] ?? 'event', $data);
    }

    public function getLoopId(): string
    {
        return $this->loopId;
    }

    public function getData(): array
    {
        return $this->data;
    }
}
